From: Florian Müllner Date: Tue, 25 May 2010 13:45:51 +0000 (+0200) Subject: [StEntry] Consider children when setting hover state X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~10010 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=cc163237cc4ab5900b331e69e53f2fca56998ac5;p=gnome-shell.git [StEntry] Consider children when setting hover state When hovering over the entry's ClutterText, the entry itself currently receives a leave event and updates the hover state. Apply the same logic as StWidget itself to treat children as part of the entry. https://bugzilla.gnome.org/show_bug.cgi?id=620381 --- diff --git a/src/st/st-entry.c b/src/st/st-entry.c index 1d641b63e..42a468709 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -577,13 +577,23 @@ st_entry_key_focus_in (ClutterActor *actor) clutter_actor_grab_key_focus (priv->entry); } +static gboolean +actor_contains (ClutterActor *widget, + ClutterActor *other) +{ + while (other != NULL && other != widget) + other = clutter_actor_get_parent (other); + return other != NULL; +} + static gboolean st_entry_enter_event (ClutterActor *actor, ClutterCrossingEvent *event) { StEntryPrivate *priv = ST_ENTRY_PRIV (actor); - if (priv->hint && priv->hint_visible) + if (actor_contains (actor, event->source) + && priv->hint && priv->hint_visible) { st_widget_set_hover (ST_WIDGET (actor), TRUE); } @@ -595,7 +605,8 @@ static gboolean st_entry_leave_event (ClutterActor *actor, ClutterCrossingEvent *event) { - st_widget_set_hover (ST_WIDGET (actor), FALSE); + if (!actor_contains (actor, event->related)) + st_widget_set_hover (ST_WIDGET (actor), FALSE); return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event); }